<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TikTok Spider API - Swagger UI</title>
    <link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@4.15.5/swagger-ui.css" />
    <style>
        html {
            box-sizing: border-box;
            overflow: -moz-scrollbars-vertical;
            overflow-y: scroll;
        }
        
        *, *:before, *:after {
            box-sizing: inherit;
        }
        
        body {
            margin:0;
            background: #fafafa;
        }
        
        .swagger-ui .topbar {
            background-color: #667eea;
            background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .swagger-ui .topbar .download-url-wrapper input[type=text] {
            border-radius: 4px 0 0 4px;
        }
        
        .swagger-ui .topbar .download-url-wrapper .download-url-button {
            border-radius: 0 4px 4px 0;
        }
    </style>
</head>
<body>
    <div id="swagger-ui"></div>
    
    <script src="https://unpkg.com/swagger-ui-dist@4.15.5/swagger-ui-bundle.js"></script>
    <script src="https://unpkg.com/swagger-ui-dist@4.15.5/swagger-ui-standalone-preset.js"></script>
    <script>
        window.onload = function() {
            // 获取当前域名和端口
            const currentUrl = window.location.origin;
            
            const ui = SwaggerUIBundle({
                url: currentUrl + '/api/spec',
                dom_id: '#swagger-ui',
                deepLinking: true,
                presets: [
                    SwaggerUIBundle.presets.apis,
                    SwaggerUIStandalonePreset
                ],
                plugins: [
                    SwaggerUIBundle.plugins.DownloadUrl
                ],
                layout: "StandaloneLayout",
                docExpansion: "list",
                operationsSorter: "alpha",
                filter: true,
                tryItOutEnabled: true,
                requestInterceptor: (request) => {
                    // 可以在这里添加请求拦截器，比如添加认证头
                    console.log('Request:', request);
                    return request;
                },
                responseInterceptor: (response) => {
                    // 可以在这里添加响应拦截器
                    console.log('Response:', response);
                    return response;
                }
            });
            
            window.ui = ui;
        };
    </script>
</body>
</html>